home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / utils / gemfsc15.lzh / AESSRC14.LZH / AESUTRS1.S < prev    next >
Text File  |  1990-05-26  |  3KB  |  85 lines

  1.  
  2. ;*========================================================================
  3. ;*
  4. ;* AESFAST Public Domain GEM bindings.
  5. ;*
  6. ;*========================================================================
  7.  
  8. ;*************************************************************************
  9. ;*
  10. ;* AESUTRS1.S - Resource-related Utilities 1 of 3.
  11. ;*  Non-standard utility functions.
  12. ;*
  13. ;*  05/26/90 - v1.4
  14. ;*             Added handling of ICON objects.
  15. ;*  08/28/89 - v1.3
  16. ;*             Changed logic to assume a normal object then look for TEXT 
  17. ;*             type objects, instead of assuming TEXT then looking for
  18. ;*             STRING or BUTTON objects.  This effectively increases the
  19. ;*             functionality of this routine:  now it can be used to set
  20. ;*             ob_spec values in general, and not just string pointers.
  21. ;*             Also changed logic to check for INDIRECT flag and handle it.
  22. ;*             (1.3b bug discovered in beta testing has been fixed: a move
  23. ;*              was changed to lea, below).
  24. ;*************************************************************************
  25.  
  26.           .include  "gemfast.sh"
  27.  
  28. ;-------------------------------------------------------------------------
  29. ; rsc_sstrings - Set pointers to strings within a tree.
  30. ;                This function sets one or more string pointers within a 
  31. ;                resource tree.  It knows the difference between strings
  32. ;                and buttons and text objects, and sets the ob_spec or
  33. ;                te_ptext pointer as appropriate. It accepts a variable
  34. ;                number of object/pointer pairs, with a negative object
  35. ;                index indicating the end of the list.
  36. ;
  37. ;  void rsc_sstrings(tree, obj1,ptr1 [,obj2,ptr2,...,objn,ptrn], -1);
  38. ;-------------------------------------------------------------------------
  39.  
  40. _rsc_sstrings::
  41.  
  42.           .cargs    #8,.ptree.l,.parms
  43.  
  44.           move.l    a2,-(sp)            ; Save Laser C register.
  45.           move.l    .ptree(sp),a2
  46.           lea       .parms(sp),a1
  47. .loop:
  48.           move.w    (a1)+,d2            ; Get object number, if negative
  49.           bmi.s     .done               ; we hit the end of the list.
  50.           move.l    (a1)+,d0            ; Get string pointer.
  51.  
  52.           muls      #OBJ_SIZ,d2         ; Turn object number into index.
  53.  
  54.           lea       ob_spec(a2,d2.l),a0 ; Get ob_spec.
  55.           btst.b    #0,ob_flags(a2,d2.l); Is INDIRECT flag set?
  56.           beq.s     .notind             ; Nope, ob_spec is all set.
  57.           move.l    (a0),a0             ; Yep, get real ob_spec.
  58. .notind:
  59.           move.w    ob_type(a2,d2.l),d1 ; Get ob_type.
  60.           cmp.b     #G_ICON,d1
  61.           beq.s     .icon
  62.           cmp.b     #G_TEXT,d1
  63.           beq.s     .text
  64.           cmp.b     #G_BOXTEXT,d1
  65.           beq.s     .text
  66.           cmp.b     #G_FTEXT,d1
  67.           beq.s     .text
  68.           cmp.b     #G_FBOXTEXT,d1
  69.           bne.s     .string
  70. .icon:
  71.           move.l    (a0),a0             ; For icon, ob_spec points to
  72.           lea       12(a0),a0           ; iconblk, text ptr is at iconblk+12.
  73.           bra.s     .string
  74. .text:    
  75.           move.l    (a0),a0             ; For text, ob_spec points to ptr.
  76. .string:
  77.           move.l    d0,(a0)             ; Store string pointer.
  78.           bra.s     .loop
  79. .done:
  80.           move.l    (sp)+,a2            ; Restore Laser C register.
  81.           rts
  82.           
  83. ;         end of code
  84.  
  85.